# coding:utf-8
"""
栈
2022年12月12日15:15:42
"""
from single_link_list import SingleLinkList

class Queue():
    def __init__(self,item = None):
        self.__list = SingleLinkList()
        if item != None:
            self.enqueue(item)
    def enqueue(self,item):
        """入队，从尾部添加"""
        self.__list.append(item)
        
    def dequeue(self):
        """出队，从头部弹出"""
        return self.__list.remove(0)
    
    def is_empty(self):
        return  self.__list.is_empty()
        
    def size(self):
        return self.__list.length()


if __name__ == "__main__":
    q = Queue(0)
    q.enqueue(1)
    q.enqueue(21)
    print(q.dequeue())
    print(q.dequeue())
    print(q.dequeue())
    print(q.size())
    print(q.is_empty())